﻿<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<link type="text/css" rel="stylesheet" href="css/layout.css" />
<!---
<link  type="text/css" rel="stylesheet" href="../css/style.css" />
<link type="text/css" rel="stylesheet" href="../css/product.css">
-->
<title>Danh sách đơn đặt hàng chi tiết</title>

<style type = "text/css">
.table_1{
border-width:0 0 0 0;
}
.table_1 tr,td{
border-style:solid;
border-width:0px;
margin-top:5px;
margin-left:20px;
margin-right:20px;
padding:5px;
}
.table_1 p{
color:red;
font: arial;
}
</style>
<body>
<?php include("menu.php"); 
include("session.php");
include("../include/config.php");
?>
<div id="head-noidung">
	<div id="head-main">
		<h3 style = "text-align:center;margin-top:5px;"> Thông Tin Đơn Đặt Hàng </h3>		
	</div>
<?php
if(isset($_REQUEST["id"]))
{
	$id_contract = $_REQUEST["id"];
	$sql0 = "SELECT * FROM contract WHERE id = $id_contract";
	$rs0 = mysql_query($sql0);
	if($rs0)
	{
	$rw0 = mysql_fetch_array($rs0);
?>
	<div id="head-main">

		<table	class = "table_1">
		<tr>
			<td style = "text-align:right;"> Tên Khách Hàng </td>
			<td> <p><?php if($rw0["sex"] == "male") echo "Anh ".$rw0["customer_name"]; else echo "Chị ".$rw0["customer_name"];?> </p></td>
		</tr>
		<tr>
			<td style = "text-align:right;">Điện Thoại </td>
			<td> <p><?php echo $rw0["phone"]; ?></p> </td>
		</tr>
		<tr>
			<td style = "text-align:right;"> Email </td>
			<td> <p><?php echo $rw0["email"]; ?></p> </td>
		</tr>
		<tr>
			<td style = "text-align:right;"> Công Ty</td>
			<td> <p><?php echo $rw0["company"]; ?></p> </td>
		</tr>
		<tr>
			<td style = "text-align:right;"> Địa Chỉ</td>
			<td> <p><?php echo $rw0["address"]; ?></p> </td>
		</tr>
		<tr>
			<td style = "text-align:right;"> Tổng Thanh Toán</td>
			<td> <p><?php echo $rw0["price"]; ?></p> </td>
		</tr>
		<tr>
			<td style = "text-align:right;"> Ngày Giao Hàng </td>
			<td> <p><?php echo $rw0["deliver_date"]; ?></p> </td>
		</tr>
		</table>
	
	</div>
	<div id="head-main">
		<h3 style = "text-align:center;margin-top:5px;"> Danh Sách Sản Phẩm </h3>		
	</div>
		<div id="head-main">
<?php
	}
		$sql = "SELECT * FROM product_deliver WHERE id_contract = $id_contract";
		$rs = mysql_query($sql);
		if($rs)
		{
		while($rw = mysql_fetch_array($rs))
		{
?>		
				<?php 	
				$id_temp = $rw["id_product"];
				$sql2="SELECT * FROM product WHERE id = $id_temp";
				$rs2=mysql_query($sql2);
				if($rs2) 
				{
					while($rw2=mysql_fetch_array($rs2))
					{
					
		?>
		<div id = "detail" style = "float:left;width:20%;">
		<a href="../product.php?id=<?php echo $rw2['id'] ?>">
		<img class="img" src="../images/product/<?php echo $rw2['image'];?>" border="0" height = "100px"/></a>
			<p><?php echo $rw2['name']; ?></p>
			<p>Mã SP: <?php echo $rw2['code']; ?></p>
			<p>Giá: <a style = "color:red;"><?php echo $rw2['price']; ?></a></p>
			<p>Số Lượng: <a style = "color:red;"><?php echo $rw["amount"]; ?> </a></p>
		</div>
		<?php 									
					} 
				}
			}
		}
	}
		?>
	</div>	
</div>


<?php include("images/cherry/footer.php"); ?>

</body>
</html>